<template>
  <div class="common-layout">
    <el-container>
      <el-aside :width="isCollapse ? '66px' : '200px'">
        <h3>青年旅社管理</h3>
        <el-menu
          default-active="2"
          @open="handleOpen"
          @close="handleClose"
          background-color="#134857"
          text-color="white"
          active-text-color="#ffd04b"
          :collapse="isCollapse"
        >
          <el-sub-menu index="1">
            <template #title>
              <el-icon><location /></el-icon>
              <span>系统管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="1-1">角色管理</el-menu-item>
              <el-menu-item index="1-2">账号管理</el-menu-item>
            </el-menu-item-group>
          </el-sub-menu>
          <el-sub-menu index="2">
            <template #title>
              <el-icon><location /></el-icon>
              <span>客房管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="1-1">类型管理</el-menu-item>
              <el-menu-item index="1-2">房间管理</el-menu-item>
            </el-menu-item-group>
          </el-sub-menu>
          <el-sub-menu index="3">
            <template #title>
              <el-icon><location /></el-icon>
              <span>顾客管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="1-1">顾客管理</el-menu-item>
            </el-menu-item-group>
          </el-sub-menu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>
          <el-menu
            :default-active="activeIndex"
            class="el-menu-demo"
            mode="horizontal"
            @select="handleSelect"
            background-color="#134857"
            text-color="white"
            active-text-color="orange"
          >
            <el-menu-item index="1" @click="isCollapse = !isCollapse"
              ><div class="checktab">
                <el-icon><operation /></el-icon>
              </div>
            </el-menu-item>
            <el-sub-menu index="2">
              <template #title>管理员</template>
              <el-menu-item index="2-1">item one</el-menu-item>
              <el-menu-item index="2-2">item two</el-menu-item>
              <el-menu-item index="2-3">item three</el-menu-item>
              <el-sub-menu index="2-4">
                <template #title>item four</template>
                <el-menu-item index="2-4-1">item one</el-menu-item>
                <el-menu-item index="2-4-2">item two</el-menu-item>
                <el-menu-item index="2-4-3">item three</el-menu-item>
              </el-sub-menu>
            </el-sub-menu>
            <el-menu-item index="4">首页</el-menu-item>
          </el-menu>
        </el-header>
        <el-main>Main</el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { ref, reactive, documentCopy } from "vue";
import { Location, Operation } from "@element-plus/icons-vue";
export default {
  setup() {
    let isCollapse = ref(false);
    const handleOpen = (key, keyPath) => {
      console.log(key, keyPath);
    };
    const handleClose = (key, keyPath) => {
      console.log(key, keyPath);
    };
    return {
      handleOpen,
      handleClose,
      isCollapse,
    };
  },
  components: {
    Location,
    Operation,
  },
};
</script>

<style>
.el-aside {
  height: 100vh;
  padding: 10px 5px;
  background-color: #134857;
  color: white;
  text-align: center;
}
.el-aside h3 {
  margin-bottom: 30px;
}
.el-sub-menu {
}
.el-header {
  height: 70px;
  line-height: 50px;
  text-align: center;
  background-color: #134857;
  color: white;
}
.el-menu {
  border: none;
}
.el-menu-item {
  height: 70px;
}
.checktab {
  width: 20px;
  height: 60px;
  text-align: center;
  line-height: 60px;
}
</style>